//
//  BodiCollectionViewCell.m
//  UI14_HomeWork_豆瓣
//
//  Created by Bodi on 16/6/24.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "BodiCollectionViewCell.h"
#import "MovieModel.h"
#import "UIImageView+WebCache.h"
@interface BodiCollectionViewCell ()

@property (nonatomic, retain)UIImageView *rainImageView;
@property (nonatomic, retain)UILabel *rainLabel;
@end


@implementation BodiCollectionViewCell
- (void)dealloc{
    [_model release];
    [_rainImageView release];
    [_rainLabel release];
    [super dealloc];
    
}
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    
    if (self) {
        self.rainImageView = [[UIImageView alloc]init];
        [self.contentView addSubview:_rainImageView];
        //        self.rainImageView.backgroundColor = [UIColor redColor];
        [_rainImageView release];
        self.rainLabel = [[UILabel alloc]init];
        self.rainLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_rainLabel];
        [_rainLabel release];
    }
    return self;
    
    
}
- (void)layoutSubviews{
    [super layoutSubviews];
    self.rainImageView.frame = self.contentView.bounds;
    self.rainLabel.frame = CGRectMake(self.rainImageView.frame.origin.x, self.contentView.frame.size.height, self.contentView.frame.size.width, 30);
//    self.rainLabel.backgroundColor = [UIColor redColor];
    
    
    
}
- (void)setModel:(MovieModel *)model{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    NSURL *url = [NSURL URLWithString:model.pic_url];
    [self.rainImageView sd_setImageWithURL:url];
    
    self.rainLabel.text = model.movieName;

}











@end
